/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package RPS;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 *
 * @author mirko
 */
public class RPS {

    public RPS(List<PeerSchema> schemas, Set<MappingAssertion> graphMappings, Set<EquivalenceMapping> equiMappings) {
        this.schemas = schemas;
        this.graphMappings = graphMappings;
        this.equiMappings = equiMappings;
    }
    
    private List<PeerSchema> schemas;
    private Set<MappingAssertion> graphMappings;
    private Set<EquivalenceMapping> equiMappings;

    public RPS() {
        this.schemas = new ArrayList<PeerSchema>();
        this.graphMappings = new HashSet<MappingAssertion>();
        this.equiMappings = new HashSet<EquivalenceMapping>();
        
    }

    public List<PeerSchema> getSchemas() {
        return schemas;
    }

    public void setSchemas(List<PeerSchema> schemas) {
        this.schemas = schemas;
    }

    public Set<MappingAssertion> getMappings() {
        return graphMappings;
    }

    public void setMappings(Set<MappingAssertion> mappings) {
        this.graphMappings = mappings;
    }

    public Set<EquivalenceMapping> getEquiMappings() {
        return equiMappings;
    }

    public void setEquiMappings(Set<EquivalenceMapping> equiMappings) {
        this.equiMappings = equiMappings;
    }
    
    public boolean addGMapping(MappingAssertion mapping){
        return this.graphMappings.add(mapping);
    }
    public boolean addEMapping (EquivalenceMapping equiMapping) {
        return this.equiMappings.add(equiMapping);
    }

    @Override
    public String toString() {
        String output, gmappings, equimappings;
        output="";
        gmappings="";
        equimappings="";
        for (MappingAssertion mapping : this.graphMappings)
            gmappings += mapping.toString() + "\n\n";
        for (EquivalenceMapping emapping : this.equiMappings)
            equimappings += emapping.toString() + "\n";
        output = "RDF Peer System" + "\nGraph mapping assertions:\n" + gmappings + "\nEquivalence mappings: \n" + equimappings ;
        
        return output;
    }
    public void addPeerSchema(PeerSchema schema){
        this.schemas.add(schema);
    }
    
    
    
}
